home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 031a / findwi.zip / REALINT.ASM < prev    next >
Assembly Source File  |  1991-02-09  |  4KB  |  110 lines

  1. ;--------------------------------------------------------------------
  2. ;
  3. ;       REALINT.ASM
  4. ;
  5. ;       ALTINTR         - calls interrupts with a true INT call
  6. ;
  7. ;       ALTINTR appeared in INFOPLUS.ASM by Andrew Rossmann, who modified
  8. ;       the *ORIGINAL* code provided by Steve Grant.  It has NOT been
  9. ;       modified here, just extracted and placed in an ASM file by itself
  10. ;
  11. ;       INFOPLUS.ASM contained many more functions and procedures than
  12. ;       ALTINTR.  It may be downloaded from BPROGA Lib2 as INFOP1.ZIP
  13. ;
  14. ;       This, like the original, is released to the public domain
  15.  
  16.  
  17. .286P
  18. .8087
  19.  
  20.  
  21. CODE    segment byte
  22.         assume cs:CODE, es:NOTHING
  23.         public ALTINTR
  24.  
  25. ; Pascal format: procedure AltIntr(intno: byte; regs: registers); external;
  26.  
  27. ALTINTRP        proc    far
  28.  
  29. regaddr equ     [bp + 6]
  30. intno   equ     [bp + 10]
  31.  
  32.  
  33. altcont:
  34.         lds     si,regaddr              ;point DS:SI to regs
  35.         mov     cs:save_ds,ds           ;save pointer for return
  36.         mov     cs:save_si,si
  37.         cld                             ;go forward
  38.         lodsw                           ;load AX and hold it
  39.         push    ax
  40.         lodsw                           ;load BX
  41.         mov     bx,ax
  42.         lodsw                           ;load CX
  43.         mov     cx,ax
  44.         lodsw                           ;load DX
  45.         mov     dx,ax
  46.         lodsw                           ;load BP
  47.         mov     bp,ax
  48.         lodsw                           ;load SI and hold it
  49.         push    ax
  50.         lodsw                           ;load DI
  51.         mov     di,ax
  52.         lodsw                           ;load DS and hold it
  53.         push    ax
  54.         lodsw                           ;load ES
  55.         mov     es,ax
  56.         lodsw                           ;load Flags
  57.         push    ax
  58.         popf
  59.         pop     ds                      ;get rest of regs
  60.         pop     si
  61.         pop     ax
  62.         db      0cdh                    ;Int opcode
  63. intrpt  db      ?                       ;loaded with real interrupt
  64.         pushf                           ;save flags and modified regs
  65.         push    es
  66.         push    di
  67.         mov     es,cs:save_ds           ;get regs pointer into ES:DI
  68.         mov     di,cs:save_si
  69.         cld                             ;go forward
  70.         stosw                           ;save AX
  71.         mov     ax,bx
  72.         stosw                           ;save BX
  73.         mov     ax,cx
  74.         stosw                           ;save CX
  75.         mov     ax,dx
  76.         stosw                           ;save DX
  77.         mov     ax,bp
  78.         stosw                           ;save BP
  79.         mov     ax,si
  80.         stosw                           ;save SI
  81.         pop     ax
  82.         stosw                           ;save DI
  83.         mov     ax,ds
  84.         stosw                           ;save DS
  85.         pop     ax
  86.         stosw                           ;save ES
  87.         pop     ax
  88.         stosw                           ;save Flags
  89.         pop     ds                      ;restore regs
  90.         pop     bp
  91.         ret     6
  92.  
  93. altintr:
  94.         push    bp
  95.         mov     bp,sp
  96.         push    ds                      ;save DS, because we screw it up
  97.         mov     al,intno                ;get interrupt number to use
  98.         mov     cs:intrpt,al            ;and modify our code
  99.         jmp     altcont                 ;continue with rest of code
  100.  
  101. ;local storage
  102.  
  103. save_ds dw      ?
  104. save_si dw      ?
  105.  
  106. ALTINTRP        endp
  107.  
  108. code    ends
  109.         end
  110.